package com.playball.lottery.util;

import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

import com.playball.lottery.customview.ChildDTO;

import android.util.Log;

/**
 * 竞彩篮球混合投注玩法奖金预测计算注数，最小最大奖金相关工具类
 * 
 * @author Administrator
 * 
 */
public class JclqHHMoneyForecastUtil {
	/**
	 * 获取一列中最大sp值集合,分别取各玩法最大sp组成一个list btn_ok.setOnClickListener
	 * 
	 * @param selectsp
	 *            ="sf,1.48/rf,1.65/rf,1.75/bf,4.50/sc,8.50/";
	 * @return [1.48, 1.75, 8.5]
	 */
	public static List<String> getTeamMaxSPList(String selectsp) {
		List<String> listAll = new ArrayList<String>();
		if (!selectsp.equals("")) {
			if (selectsp.length() >= 1) {
				selectsp = selectsp.substring(0, selectsp.length() - 1);
			}
			String[] strs = selectsp.split("/");// dxf1,1.70

			List<String> listSf = new ArrayList<String>();
			List<String> listRfsf = new ArrayList<String>();
			List<String> listDxf = new ArrayList<String>();
			List<String> listSfc = new ArrayList<String>();
			for (int i = 0; i < strs.length; i++) {
				if (strs[i].contains("sf")) {
					listSf.add(strs[i]);
				}
				if (strs[i].contains("rf")) {
					listRfsf.add(strs[i]);
				}
				if (strs[i].contains("dxf")) {
					listDxf.add(strs[i]);
				}
				if (strs[i].contains("sc")) {
					listSfc.add(strs[i]);
				}
			}

			if (listSf.size() != 0) {
				List<Float> listSpfF = new ArrayList<Float>();
				for (int k = 0; k < listSf.size(); k++) {
					listSpfF.add(Float.parseFloat(listSf.get(k).split(",")[1]));
				}

				float spfmax = Collections.max(listSpfF);
				String max = String.valueOf(spfmax);
				listAll.add(max);
			}

			if (listRfsf.size() != 0) {
				List<Float> listRqspfF = new ArrayList<Float>();
				for (int k = 0; k < listRfsf.size(); k++) {
					listRqspfF.add(Float.parseFloat(listRfsf.get(k).split(",")[1]));
				}

				float rqspfmax = Collections.max(listRqspfF);
				String max = String.valueOf(rqspfmax);
				listAll.add(max);
			}

			if (listDxf.size() != 0) {
				List<Float> listZjqF = new ArrayList<Float>();
				for (int k = 0; k < listDxf.size(); k++) {
					listZjqF.add(Float.parseFloat(listDxf.get(k).split(",")[1]));
				}

				float zjqmax = Collections.max(listZjqF);
				String max = String.valueOf(zjqmax);
				listAll.add(max);
			}

			if (listSfc.size() != 0) {
				List<Float> listBqcF = new ArrayList<Float>();
				for (int k = 0; k < listSfc.size(); k++) {
					listBqcF.add(Float.parseFloat(listSfc.get(k).split(",")[1]));
				}

				float bqcmax = Collections.max(listBqcF);
				String max = String.valueOf(bqcmax);
				listAll.add(max);
			}
		}
		return listAll;
	}

	/**
	 * 获取一列中最小sp值
	 * 
	 * @param selectsp
	 *            =dxf1,1.70/sfc1,6.50/
	 * @return
	 */
	public static String getTeamMinSP(String selectsp) {
		// Log.d("getTeamMinSP", "selectsp= " + selectsp.toString());
		// "1.50,1.80," selectsp
		String str_sp0 = selectsp.substring(0, selectsp.length() - 1);
		String[] strs = str_sp0.split("/");
		List<Float> listf = new ArrayList<Float>();
		for (int k = 0; k < strs.length; k++) {
			listf.add(Float.parseFloat(strs[k].split(",")[1]));
		}
		// Log.v("getTeamMinSP", "listf= " + listf.toString());
		float fmin = Collections.min(listf);
		// System.out.println("fmin= " + fmin);
		String min = String.valueOf(fmin);
		return min;
	}

	/**
	 * 获取一列中注数
	 * 
	 * @param sp
	 *            =sf1,1.48/rfsf1,1.65/rfsf0,1.75/sfc0,4.50/
	 * @return
	 */
	public static int getTeamCount(String sp) {
		// Log.d("getTeamCount", "sp= " + sp.toString());
		int c = 0;
		// sp //"1.50,1.80,"
		if (sp != null) {
			String str_sp0 = sp.substring(0, sp.length() - 1);
			String[] strs = str_sp0.split("/");
			c = strs.length;
		}
		return c;
	}

	/**
	 * 计算注数，最小奖金，最大奖金
	 * 
	 * @param num
	 * @param list
	 * @return 注数|最小奖金|最大奖金
	 */
	public static String getMatchCount(int num, List<ChildDTO> list) {

		String result;
		long c = 0;
		BigDecimal bdmaxM = new BigDecimal("0");
		BigDecimal bdminM = new BigDecimal("0");
		if (num == 2) {
			boolean isFirst = true;
			for (int i = 0; i < list.size(); ++i) {
				ChildDTO child = new ChildDTO();
				child = list.get(i);
				// 此处sp值根据不同玩法不同，拿取sp值变量不一样
				int num1 = getTeamCount(child.lqhhtzsp);
				List<String> liststr1 = new ArrayList<String>();
				liststr1 = getTeamMaxSPList(child.lqhhtzsp);
				BigDecimal bdi1 = new BigDecimal(getTeamMinSP(child.lqhhtzsp));
				for (int j = i + 1; j < list.size(); ++j) {
					ChildDTO child2 = new ChildDTO();
					child2 = list.get(j);
					int num2 = getTeamCount(child2.lqhhtzsp);
					List<String> liststr2 = new ArrayList<String>();
					liststr2 = getTeamMaxSPList(child2.lqhhtzsp);
					BigDecimal bdi2 = new BigDecimal(getTeamMinSP(child2.lqhhtzsp));
					c += num1 * num2;
					for (int m = 0; m < liststr1.size(); m++) {
						BigDecimal bda1 = new BigDecimal(liststr1.get(m).toString());
						for (int n = 0; n < liststr2.size(); n++) {
							BigDecimal bda2 = new BigDecimal(liststr2.get(n).toString());
							bdmaxM = bdmaxM.add(bda1.multiply(bda2));
						}
					}
					BigDecimal bdtemp = bdi1.multiply(bdi2);
					if (isFirst) {
						BigDecimal i0 = new BigDecimal(getTeamMinSP(list.get(0).lqhhtzsp));
						BigDecimal i1 = new BigDecimal(getTeamMinSP(list.get(1).lqhhtzsp));
						bdminM = i0.multiply(i1);
						isFirst = false;
					}
					if (bdtemp.compareTo(bdminM) == -1 || bdtemp.compareTo(bdminM) == 0) {
						bdminM = bdtemp;
					}
				}
			}
		} else if (num == 3) {
			boolean isFirst = true;
			for (int i = 0; i < list.size(); ++i) {
				ChildDTO child = new ChildDTO();
				child = list.get(i);
				int num1 = getTeamCount(child.lqhhtzsp);
				List<String> liststr1 = new ArrayList<String>();
				liststr1 = getTeamMaxSPList(child.lqhhtzsp);
				// BigDecimal bda1 = new
				// BigDecimal(getTeamMaxSP(child.lqhhtzsp));
				BigDecimal bdi1 = new BigDecimal(getTeamMinSP(child.lqhhtzsp));
				for (int j = i + 1; j < list.size(); ++j) {
					ChildDTO child2 = new ChildDTO();
					child2 = list.get(j);
					int num2 = getTeamCount(child2.lqhhtzsp);
					List<String> liststr2 = new ArrayList<String>();
					liststr2 = getTeamMaxSPList(child2.lqhhtzsp);
					// BigDecimal bda2 = new
					// BigDecimal(getTeamMaxSP(child2.lqhhtzsp));
					BigDecimal bdi2 = new BigDecimal(getTeamMinSP(child2.lqhhtzsp));
					for (int k = j + 1; k < list.size(); ++k) {
						ChildDTO child3 = new ChildDTO();
						child3 = list.get(k);
						int num3 = getTeamCount(child3.lqhhtzsp);
						List<String> liststr3 = new ArrayList<String>();
						liststr3 = getTeamMaxSPList(child3.lqhhtzsp);
						// BigDecimal bda3 = new
						// BigDecimal(getTeamMaxSP(child3.lqhhtzsp));
						BigDecimal bdi3 = new BigDecimal(getTeamMinSP(child3.lqhhtzsp));

						c += num1 * num2 * num3;
						for (int m = 0; m < liststr1.size(); m++) {
							// int num1=listint221.get(m);
							BigDecimal bda1 = new BigDecimal(liststr1.get(m).toString());
							for (int n = 0; n < liststr2.size(); n++) {
								BigDecimal bda2 = new BigDecimal(liststr2.get(n).toString());
								for (int z = 0; z < liststr3.size(); z++) {
									BigDecimal bda3 = new BigDecimal(liststr3.get(z).toString());
									bdmaxM = bdmaxM.add(bda1.multiply(bda2).multiply(bda3));
								}
							}
						}
						// bdmaxM =
						// bdmaxM.add(bda1.multiply(bda2).multiply(bda3));
						BigDecimal bdtemp = bdi1.multiply(bdi2).multiply(bdi3);
						if (isFirst) {
							BigDecimal i0 = new BigDecimal(getTeamMinSP(list.get(0).lqhhtzsp));
							BigDecimal i1 = new BigDecimal(getTeamMinSP(list.get(1).lqhhtzsp));
							BigDecimal i2 = new BigDecimal(getTeamMinSP(list.get(2).lqhhtzsp));
							bdminM = i0.multiply(i1).multiply(i2);
							isFirst = false;
						}
						if (bdtemp.compareTo(bdminM) == -1 || bdtemp.compareTo(bdminM) == 0) {
							bdminM = bdtemp;
						}
					}
				}
			}
		} else if (num == 4) {
			boolean isFirst = true;
			for (int i = 0; i < list.size(); ++i) {

				ChildDTO child = new ChildDTO();
				child = list.get(i);
				int num1 = getTeamCount(child.lqhhtzsp);
				List<String> liststr1 = new ArrayList<String>();
				liststr1 = getTeamMaxSPList(child.lqhhtzsp);
				// BigDecimal bda1 = new
				// BigDecimal(getTeamMaxSP(child.lqhhtzsp));
				BigDecimal bdi1 = new BigDecimal(getTeamMinSP(child.lqhhtzsp));
				for (int j = i + 1; j < list.size(); ++j) {
					ChildDTO child2 = new ChildDTO();
					child2 = list.get(j);
					int num2 = getTeamCount(child2.lqhhtzsp);
					List<String> liststr2 = new ArrayList<String>();
					liststr2 = getTeamMaxSPList(child2.lqhhtzsp);
					// BigDecimal bda2 = new
					// BigDecimal(getTeamMaxSP(child2.lqhhtzsp));
					BigDecimal bdi2 = new BigDecimal(getTeamMinSP(child2.lqhhtzsp));
					for (int k = j + 1; k < list.size(); ++k) {
						ChildDTO child3 = new ChildDTO();
						child3 = list.get(k);
						int num3 = getTeamCount(child3.lqhhtzsp);
						List<String> liststr3 = new ArrayList<String>();
						liststr3 = getTeamMaxSPList(child3.lqhhtzsp);
						// BigDecimal bda3 = new
						// BigDecimal(getTeamMaxSP(child3.lqhhtzsp));
						BigDecimal bdi3 = new BigDecimal(getTeamMinSP(child3.lqhhtzsp));
						for (int m = k + 1; m < list.size(); ++m) {
							ChildDTO child4 = new ChildDTO();
							child4 = list.get(m);
							int num4 = getTeamCount(child4.lqhhtzsp);
							List<String> liststr4 = new ArrayList<String>();
							liststr4 = getTeamMaxSPList(child4.lqhhtzsp);
							// BigDecimal bda4 = new
							// BigDecimal(getTeamMaxSP(child4.lqhhtzsp));
							BigDecimal bdi4 = new BigDecimal(getTeamMinSP(child4.lqhhtzsp));
							c += num1 * num2 * num3 * num4;
							for (int p = 0; p < liststr1.size(); p++) {
								BigDecimal bda1 = new BigDecimal(liststr1.get(p).toString());
								for (int n = 0; n < liststr2.size(); n++) {
									BigDecimal bda2 = new BigDecimal(liststr2.get(n).toString());
									for (int z = 0; z < liststr3.size(); z++) {
										BigDecimal bda3 = new BigDecimal(liststr3.get(z).toString());
										for (int x = 0; x < liststr4.size(); x++) {
											BigDecimal bda4 = new BigDecimal(liststr4.get(x).toString());
											bdmaxM = bdmaxM.add(bda1.multiply(bda2).multiply(bda3).multiply(bda4));
										}
									}
								}
							}
							// bdmaxM =
							// bdmaxM.add(bda1.multiply(bda2).multiply(bda3).multiply(bda4));
							BigDecimal bdtemp = bdi1.multiply(bdi2).multiply(bdi3).multiply(bdi4);
							if (isFirst) {
								BigDecimal i0 = new BigDecimal(getTeamMinSP(list.get(0).lqhhtzsp));
								BigDecimal i1 = new BigDecimal(getTeamMinSP(list.get(1).lqhhtzsp));
								BigDecimal i2 = new BigDecimal(getTeamMinSP(list.get(2).lqhhtzsp));
								BigDecimal i3 = new BigDecimal(getTeamMinSP(list.get(3).lqhhtzsp));
								bdminM = i0.multiply(i1).multiply(i2).multiply(i3);
								isFirst = false;
							}
							if (bdtemp.compareTo(bdminM) == -1 || bdtemp.compareTo(bdminM) == 0) {
								bdminM = bdtemp;
							}
						}
					}
				}
			}
		} else if (num == 5) {
			boolean isFirst = true;
			for (int i = 0; i < list.size(); ++i) {

				ChildDTO child = new ChildDTO();
				child = list.get(i);
				int num1 = getTeamCount(child.lqhhtzsp);
				List<String> liststr1 = new ArrayList<String>();
				liststr1 = getTeamMaxSPList(child.lqhhtzsp);
				// BigDecimal bda1 = new
				// BigDecimal(getTeamMaxSP(child.lqhhtzsp));
				BigDecimal bdi1 = new BigDecimal(getTeamMinSP(child.lqhhtzsp));
				for (int j = i + 1; j < list.size(); ++j) {
					ChildDTO child2 = new ChildDTO();
					child2 = list.get(j);
					int num2 = getTeamCount(child2.lqhhtzsp);
					List<String> liststr2 = new ArrayList<String>();
					liststr2 = getTeamMaxSPList(child2.lqhhtzsp);
					// BigDecimal bda2 = new
					// BigDecimal(getTeamMaxSP(child2.lqhhtzsp));
					BigDecimal bdi2 = new BigDecimal(getTeamMinSP(child2.lqhhtzsp));
					for (int k = j + 1; k < list.size(); ++k) {
						ChildDTO child3 = new ChildDTO();
						child3 = list.get(k);
						int num3 = getTeamCount(child3.lqhhtzsp);
						List<String> liststr3 = new ArrayList<String>();
						liststr3 = getTeamMaxSPList(child3.lqhhtzsp);
						// BigDecimal bda3 = new
						// BigDecimal(getTeamMaxSP(child3.lqhhtzsp));
						BigDecimal bdi3 = new BigDecimal(getTeamMinSP(child3.lqhhtzsp));
						for (int m = k + 1; m < list.size(); ++m) {
							ChildDTO child4 = new ChildDTO();
							child4 = list.get(m);
							int num4 = getTeamCount(child4.lqhhtzsp);
							List<String> liststr4 = new ArrayList<String>();
							liststr4 = getTeamMaxSPList(child4.lqhhtzsp);
							// BigDecimal bda4 = new
							// BigDecimal(getTeamMaxSP(child4.lqhhtzsp));
							BigDecimal bdi4 = new BigDecimal(getTeamMinSP(child4.lqhhtzsp));
							for (int n = m + 1; n < list.size(); ++n) {
								ChildDTO child5 = new ChildDTO();
								child5 = list.get(n);
								int num5 = getTeamCount(child5.lqhhtzsp);
								List<String> liststr5 = new ArrayList<String>();
								liststr5 = getTeamMaxSPList(child5.lqhhtzsp);
								// BigDecimal bda5 = new
								// BigDecimal(getTeamMaxSP(child5.lqhhtzsp));
								BigDecimal bdi5 = new BigDecimal(getTeamMinSP(child5.lqhhtzsp));
								c += num1 * num2 * num3 * num4 * num5;
								for (int p = 0; p < liststr1.size(); p++) {
									// int num1=listint221.get(m);
									BigDecimal bda1 = new BigDecimal(liststr1.get(p).toString());
									for (int a = 0; a < liststr2.size(); a++) {
										BigDecimal bda2 = new BigDecimal(liststr2.get(a).toString());
										for (int z = 0; z < liststr3.size(); z++) {
											BigDecimal bda3 = new BigDecimal(liststr3.get(z).toString());
											for (int x = 0; x < liststr4.size(); x++) {
												BigDecimal bda4 = new BigDecimal(liststr4.get(x).toString());
												for (int y = 0; y < liststr5.size(); y++) {
													BigDecimal bda5 = new BigDecimal(liststr5.get(y).toString());
													bdmaxM = bdmaxM.add(bda1.multiply(bda2).multiply(bda3).multiply(bda4).multiply(bda5));
												}

											}
										}
									}
								}
								// bdmaxM =
								// bdmaxM.add(bda1.multiply(bda2).multiply(bda3).multiply(bda4).multiply(bda5));
								BigDecimal bdtemp = bdi1.multiply(bdi2).multiply(bdi3).multiply(bdi4).multiply(bdi5);
								if (isFirst) {
									BigDecimal i0 = new BigDecimal(getTeamMinSP(list.get(0).lqhhtzsp));
									BigDecimal i1 = new BigDecimal(getTeamMinSP(list.get(1).lqhhtzsp));
									BigDecimal i2 = new BigDecimal(getTeamMinSP(list.get(2).lqhhtzsp));
									BigDecimal i3 = new BigDecimal(getTeamMinSP(list.get(3).lqhhtzsp));
									BigDecimal i4 = new BigDecimal(getTeamMinSP(list.get(4).lqhhtzsp));
									bdminM = i0.multiply(i1).multiply(i2).multiply(i3).multiply(i4);
									isFirst = false;
								}
								if (bdtemp.compareTo(bdminM) == -1 || bdtemp.compareTo(bdminM) == 0) {
									bdminM = bdtemp;
								}
							}
						}
					}
				}
			}
		} else if (num == 6) {
			boolean isFirst = true;
			for (int i = 0; i < list.size(); ++i) {
				ChildDTO child = new ChildDTO();
				child = list.get(i);
				int num1 = getTeamCount(child.lqhhtzsp);
				List<String> liststr1 = new ArrayList<String>();
				liststr1 = getTeamMaxSPList(child.lqhhtzsp);
				// BigDecimal bda1 = new
				// BigDecimal(getTeamMaxSP(child.lqhhtzsp));
				BigDecimal bdi1 = new BigDecimal(getTeamMinSP(child.lqhhtzsp));
				for (int j = i + 1; j < list.size(); ++j) {
					ChildDTO child2 = new ChildDTO();
					child2 = list.get(j);
					int num2 = getTeamCount(child2.lqhhtzsp);
					List<String> liststr2 = new ArrayList<String>();
					liststr2 = getTeamMaxSPList(child2.lqhhtzsp);
					// BigDecimal bda2 = new
					// BigDecimal(getTeamMaxSP(child2.lqhhtzsp));
					BigDecimal bdi2 = new BigDecimal(getTeamMinSP(child2.lqhhtzsp));
					for (int k = j + 1; k < list.size(); ++k) {
						ChildDTO child3 = new ChildDTO();
						child3 = list.get(k);
						int num3 = getTeamCount(child3.lqhhtzsp);
						List<String> liststr3 = new ArrayList<String>();
						liststr3 = getTeamMaxSPList(child3.lqhhtzsp);
						// BigDecimal bda3 = new
						// BigDecimal(getTeamMaxSP(child3.lqhhtzsp));
						BigDecimal bdi3 = new BigDecimal(getTeamMinSP(child3.lqhhtzsp));
						for (int m = k + 1; m < list.size(); ++m) {
							ChildDTO child4 = new ChildDTO();
							child4 = list.get(m);
							int num4 = getTeamCount(child4.lqhhtzsp);
							List<String> liststr4 = new ArrayList<String>();
							liststr4 = getTeamMaxSPList(child4.lqhhtzsp);
							// BigDecimal bda4 = new
							// BigDecimal(getTeamMaxSP(child4.lqhhtzsp));
							BigDecimal bdi4 = new BigDecimal(getTeamMinSP(child4.lqhhtzsp));
							for (int n = m + 1; n < list.size(); ++n) {
								ChildDTO child5 = new ChildDTO();
								child5 = list.get(n);
								int num5 = getTeamCount(child5.lqhhtzsp);
								List<String> liststr5 = new ArrayList<String>();
								liststr5 = getTeamMaxSPList(child5.lqhhtzsp);
								// BigDecimal bda5 = new
								// BigDecimal(getTeamMaxSP(child5.lqhhtzsp));
								BigDecimal bdi5 = new BigDecimal(getTeamMinSP(child5.lqhhtzsp));
								for (int o = n + 1; o < list.size(); ++o) {
									ChildDTO child6 = new ChildDTO();
									child6 = list.get(o);
									int num6 = getTeamCount(child6.lqhhtzsp);
									List<String> liststr6 = new ArrayList<String>();
									liststr6 = getTeamMaxSPList(child6.lqhhtzsp);
									// BigDecimal bda6 = new
									// BigDecimal(getTeamMaxSP(child6.lqhhtzsp));
									BigDecimal bdi6 = new BigDecimal(getTeamMinSP(child6.lqhhtzsp));
									c += num1 * num2 * num3 * num4 * num5 * num6;
									for (int p = 0; p < liststr1.size(); p++) {
										// int num1=listint221.get(m);
										BigDecimal bda1 = new BigDecimal(liststr1.get(p).toString());
										for (int a = 0; a < liststr2.size(); a++) {
											BigDecimal bda2 = new BigDecimal(liststr2.get(a).toString());
											for (int z = 0; z < liststr3.size(); z++) {
												BigDecimal bda3 = new BigDecimal(liststr3.get(z).toString());
												for (int x = 0; x < liststr4.size(); x++) {
													BigDecimal bda4 = new BigDecimal(liststr4.get(x).toString());
													for (int y = 0; y < liststr5.size(); y++) {
														BigDecimal bda5 = new BigDecimal(liststr5.get(y).toString());
														for (int r = 0; r < liststr6.size(); r++) {
															BigDecimal bda6 = new BigDecimal(liststr6.get(r).toString());
															bdmaxM = bdmaxM
																	.add(bda1.multiply(bda2).multiply(bda3).multiply(bda4).multiply(bda5).multiply(bda6));
														}
													}
												}
											}
										}
									}
									// bdmaxM =
									// bdmaxM.add(bda1.multiply(bda2).multiply(bda3).multiply(bda4).multiply(bda5).multiply(bda6));
									BigDecimal bdtemp = bdi1.multiply(bdi2).multiply(bdi3).multiply(bdi4).multiply(bdi5).multiply(bdi6);
									if (isFirst) {
										BigDecimal i0 = new BigDecimal(getTeamMinSP(list.get(0).lqhhtzsp));
										BigDecimal i1 = new BigDecimal(getTeamMinSP(list.get(1).lqhhtzsp));
										BigDecimal i2 = new BigDecimal(getTeamMinSP(list.get(2).lqhhtzsp));
										BigDecimal i3 = new BigDecimal(getTeamMinSP(list.get(3).lqhhtzsp));
										BigDecimal i4 = new BigDecimal(getTeamMinSP(list.get(4).lqhhtzsp));
										BigDecimal i5 = new BigDecimal(getTeamMinSP(list.get(5).lqhhtzsp));
										bdminM = i0.multiply(i1).multiply(i2).multiply(i3).multiply(i4).multiply(i5);
										isFirst = false;
									}
									if (bdtemp.compareTo(bdminM) == -1 || bdtemp.compareTo(bdminM) == 0) {
										bdminM = bdtemp;
									}
								}
							}
						}
					}
				}
			}
		} else if (num == 7) {
			boolean isFirst = true;
			for (int i = 0; i < list.size(); ++i) {
				ChildDTO child = new ChildDTO();
				child = list.get(i);
				int num1 = getTeamCount(child.lqhhtzsp);
				List<String> liststr1 = new ArrayList<String>();
				liststr1 = getTeamMaxSPList(child.lqhhtzsp);
				// BigDecimal bda1 = new
				// BigDecimal(getTeamMaxSP(child.lqhhtzsp));
				BigDecimal bdi1 = new BigDecimal(getTeamMinSP(child.lqhhtzsp));
				for (int j = i + 1; j < list.size(); ++j) {
					ChildDTO child2 = new ChildDTO();
					child2 = list.get(j);
					int num2 = getTeamCount(child2.lqhhtzsp);
					List<String> liststr2 = new ArrayList<String>();
					liststr2 = getTeamMaxSPList(child2.lqhhtzsp);
					// BigDecimal bda2 = new
					// BigDecimal(getTeamMaxSP(child2.lqhhtzsp));
					BigDecimal bdi2 = new BigDecimal(getTeamMinSP(child2.lqhhtzsp));
					for (int k = j + 1; k < list.size(); ++k) {
						ChildDTO child3 = new ChildDTO();
						child3 = list.get(k);
						int num3 = getTeamCount(child3.lqhhtzsp);
						List<String> liststr3 = new ArrayList<String>();
						liststr3 = getTeamMaxSPList(child3.lqhhtzsp);
						// BigDecimal bda3 = new
						// BigDecimal(getTeamMaxSP(child3.lqhhtzsp));
						BigDecimal bdi3 = new BigDecimal(getTeamMinSP(child3.lqhhtzsp));
						for (int m = k + 1; m < list.size(); ++m) {
							ChildDTO child4 = new ChildDTO();
							child4 = list.get(m);
							int num4 = getTeamCount(child4.lqhhtzsp);
							List<String> liststr4 = new ArrayList<String>();
							liststr4 = getTeamMaxSPList(child4.lqhhtzsp);
							// BigDecimal bda4 = new
							// BigDecimal(getTeamMaxSP(child4.lqhhtzsp));
							BigDecimal bdi4 = new BigDecimal(getTeamMinSP(child4.lqhhtzsp));
							for (int n = m + 1; n < list.size(); ++n) {
								ChildDTO child5 = new ChildDTO();
								child5 = list.get(n);
								int num5 = getTeamCount(child5.lqhhtzsp);
								List<String> liststr5 = new ArrayList<String>();
								liststr5 = getTeamMaxSPList(child5.lqhhtzsp);
								// BigDecimal bda5 = new
								// BigDecimal(getTeamMaxSP(child5.lqhhtzsp));
								BigDecimal bdi5 = new BigDecimal(getTeamMinSP(child5.lqhhtzsp));
								for (int o = n + 1; o < list.size(); ++o) {
									ChildDTO child6 = new ChildDTO();
									child6 = list.get(o);
									int num6 = getTeamCount(child6.lqhhtzsp);
									List<String> liststr6 = new ArrayList<String>();
									liststr6 = getTeamMaxSPList(child6.lqhhtzsp);
									// BigDecimal bda6 = new
									// BigDecimal(getTeamMaxSP(child6.lqhhtzsp));
									BigDecimal bdi6 = new BigDecimal(getTeamMinSP(child6.lqhhtzsp));
									for (int p = o + 1; p < list.size(); ++p) {
										ChildDTO child7 = new ChildDTO();
										child7 = list.get(p);
										int num7 = getTeamCount(child7.lqhhtzsp);
										List<String> liststr7 = new ArrayList<String>();
										liststr7 = getTeamMaxSPList(child7.lqhhtzsp);
										// BigDecimal bda7 = new
										// BigDecimal(getTeamMaxSP(child7.lqhhtzsp));
										BigDecimal bdi7 = new BigDecimal(getTeamMinSP(child7.lqhhtzsp));
										c += num1 * num2 * num3 * num4 * num5 * num6 * num7;
										for (int w = 0; w < liststr1.size(); w++) {
											// int num1=listint221.get(m);
											BigDecimal bda1 = new BigDecimal(liststr1.get(w).toString());
											for (int a = 0; a < liststr2.size(); a++) {
												BigDecimal bda2 = new BigDecimal(liststr2.get(a).toString());
												for (int z = 0; z < liststr3.size(); z++) {
													BigDecimal bda3 = new BigDecimal(liststr3.get(z).toString());
													for (int x = 0; x < liststr4.size(); x++) {
														BigDecimal bda4 = new BigDecimal(liststr4.get(x).toString());
														for (int y = 0; y < liststr5.size(); y++) {
															BigDecimal bda5 = new BigDecimal(liststr5.get(y).toString());
															for (int r = 0; r < liststr6.size(); r++) {
																BigDecimal bda6 = new BigDecimal(liststr6.get(r).toString());
																for (int t = 0; t < liststr7.size(); t++) {
																	BigDecimal bda7 = new BigDecimal(liststr7.get(t).toString());
																	bdmaxM = bdmaxM.add(bda1.multiply(bda2).multiply(bda3).multiply(bda4).multiply(bda5)
																			.multiply(bda6).multiply(bda7));
																}
															}
														}
													}
												}
											}
										}
										// bdmaxM =
										// bdmaxM.add(bda1.multiply(bda2).multiply(bda3).multiply(bda4).multiply(bda5).multiply(bda6).multiply(bda7));
										BigDecimal bdtemp = bdi1.multiply(bdi2).multiply(bdi3).multiply(bdi4).multiply(bdi5).multiply(bdi6).multiply(bdi7);
										if (isFirst) {
											BigDecimal i0 = new BigDecimal(getTeamMinSP(list.get(0).lqhhtzsp));
											BigDecimal i1 = new BigDecimal(getTeamMinSP(list.get(1).lqhhtzsp));
											BigDecimal i2 = new BigDecimal(getTeamMinSP(list.get(2).lqhhtzsp));
											BigDecimal i3 = new BigDecimal(getTeamMinSP(list.get(3).lqhhtzsp));
											BigDecimal i4 = new BigDecimal(getTeamMinSP(list.get(4).lqhhtzsp));
											BigDecimal i5 = new BigDecimal(getTeamMinSP(list.get(5).lqhhtzsp));
											BigDecimal i6 = new BigDecimal(getTeamMinSP(list.get(6).lqhhtzsp));
											bdminM = i0.multiply(i1).multiply(i2).multiply(i3).multiply(i4).multiply(i5).multiply(i6);
											isFirst = false;
										}
										if (bdtemp.compareTo(bdminM) == -1 || bdtemp.compareTo(bdminM) == 0) {
											bdminM = bdtemp;
										}
									}
								}
							}
						}
					}
				}
			}
		} else if (num == 8) {
			boolean isFirst = true;
			for (int i = 0; i < list.size(); ++i) {
				ChildDTO child = new ChildDTO();
				child = list.get(i);
				int num1 = getTeamCount(child.lqhhtzsp);
				List<String> liststr1 = new ArrayList<String>();
				liststr1 = getTeamMaxSPList(child.lqhhtzsp);
				// BigDecimal bda1 = new
				// BigDecimal(getTeamMaxSP(child.lqhhtzsp));
				BigDecimal bdi1 = new BigDecimal(getTeamMinSP(child.lqhhtzsp));
				for (int j = i + 1; j < list.size(); ++j) {
					ChildDTO child2 = new ChildDTO();
					child2 = list.get(j);
					int num2 = getTeamCount(child2.lqhhtzsp);
					List<String> liststr2 = new ArrayList<String>();
					liststr2 = getTeamMaxSPList(child2.lqhhtzsp);
					// BigDecimal bda2 = new
					// BigDecimal(getTeamMaxSP(child2.lqhhtzsp));
					BigDecimal bdi2 = new BigDecimal(getTeamMinSP(child2.lqhhtzsp));
					for (int k = j + 1; k < list.size(); ++k) {
						ChildDTO child3 = new ChildDTO();
						child3 = list.get(k);
						int num3 = getTeamCount(child3.lqhhtzsp);
						List<String> liststr3 = new ArrayList<String>();
						liststr3 = getTeamMaxSPList(child3.lqhhtzsp);
						// BigDecimal bda3 = new
						// BigDecimal(getTeamMaxSP(child3.lqhhtzsp));
						BigDecimal bdi3 = new BigDecimal(getTeamMinSP(child3.lqhhtzsp));
						for (int m = k + 1; m < list.size(); ++m) {
							ChildDTO child4 = new ChildDTO();
							child4 = list.get(m);
							int num4 = getTeamCount(child4.lqhhtzsp);
							List<String> liststr4 = new ArrayList<String>();
							liststr4 = getTeamMaxSPList(child4.lqhhtzsp);
							// BigDecimal bda4 = new
							// BigDecimal(getTeamMaxSP(child4.lqhhtzsp));
							BigDecimal bdi4 = new BigDecimal(getTeamMinSP(child4.lqhhtzsp));
							for (int n = m + 1; n < list.size(); ++n) {
								ChildDTO child5 = new ChildDTO();
								child5 = list.get(n);
								int num5 = getTeamCount(child5.lqhhtzsp);
								List<String> liststr5 = new ArrayList<String>();
								liststr5 = getTeamMaxSPList(child5.lqhhtzsp);
								// BigDecimal bda5 = new
								// BigDecimal(getTeamMaxSP(child5.lqhhtzsp));
								BigDecimal bdi5 = new BigDecimal(getTeamMinSP(child5.lqhhtzsp));
								for (int o = n + 1; o < list.size(); ++o) {
									ChildDTO child6 = new ChildDTO();
									child6 = list.get(o);
									int num6 = getTeamCount(child6.lqhhtzsp);
									List<String> liststr6 = new ArrayList<String>();
									liststr6 = getTeamMaxSPList(child6.lqhhtzsp);
									// BigDecimal bda6 = new
									// BigDecimal(getTeamMaxSP(child6.lqhhtzsp));
									BigDecimal bdi6 = new BigDecimal(getTeamMinSP(child6.lqhhtzsp));
									for (int p = o + 1; p < list.size(); ++p) {
										ChildDTO child7 = new ChildDTO();
										child7 = list.get(p);
										int num7 = getTeamCount(child7.lqhhtzsp);
										List<String> liststr7 = new ArrayList<String>();
										liststr7 = getTeamMaxSPList(child7.lqhhtzsp);
										// BigDecimal bda7 = new
										// BigDecimal(getTeamMaxSP(child7.lqhhtzsp));
										BigDecimal bdi7 = new BigDecimal(getTeamMinSP(child7.lqhhtzsp));
										for (int q = p + 1; q < list.size(); ++q) {
											ChildDTO child8 = new ChildDTO();
											child8 = list.get(q);
											int num8 = getTeamCount(child8.lqhhtzsp);
											List<String> liststr8 = new ArrayList<String>();
											liststr8 = getTeamMaxSPList(child8.lqhhtzsp);
											// BigDecimal bda8 = new
											// BigDecimal(getTeamMaxSP(child8.lqhhtzsp));
											BigDecimal bdi8 = new BigDecimal(getTeamMinSP(child8.lqhhtzsp));
											c += num1 * num2 * num3 * num4 * num5 * num6 * num7 * num8;
											for (int w = 0; w < liststr1.size(); w++) {
												// int num1=listint221.get(m);
												BigDecimal bda1 = new BigDecimal(liststr1.get(w).toString());
												for (int a = 0; a < liststr2.size(); a++) {
													BigDecimal bda2 = new BigDecimal(liststr2.get(a).toString());
													for (int z = 0; z < liststr3.size(); z++) {
														BigDecimal bda3 = new BigDecimal(liststr3.get(z).toString());
														for (int x = 0; x < liststr4.size(); x++) {
															BigDecimal bda4 = new BigDecimal(liststr4.get(x).toString());
															for (int y = 0; y < liststr5.size(); y++) {
																BigDecimal bda5 = new BigDecimal(liststr5.get(y).toString());
																for (int r = 0; r < liststr6.size(); r++) {
																	BigDecimal bda6 = new BigDecimal(liststr6.get(r).toString());
																	for (int t = 0; t < liststr7.size(); t++) {
																		BigDecimal bda7 = new BigDecimal(liststr7.get(t).toString());
																		for (int u = 0; u < liststr8.size(); u++) {
																			BigDecimal bda8 = new BigDecimal(liststr8.get(u).toString());
																			bdmaxM = bdmaxM.add(bda1.multiply(bda2).multiply(bda3).multiply(bda4)
																					.multiply(bda5).multiply(bda6).multiply(bda7).multiply(bda8));
																		}
																	}
																}
															}
														}
													}
												}
											}
											// bdmaxM =
											// bdmaxM.add(bda1.multiply(bda2).multiply(bda3).multiply(bda4).multiply(bda5).multiply(bda6).multiply(bda7).multiply(bda8));
											BigDecimal bdtemp = bdi1.multiply(bdi2).multiply(bdi3).multiply(bdi4).multiply(bdi5).multiply(bdi6).multiply(bdi7)
													.multiply(bdi8);
											if (isFirst) {
												BigDecimal i0 = new BigDecimal(getTeamMinSP(list.get(0).lqhhtzsp));
												BigDecimal i1 = new BigDecimal(getTeamMinSP(list.get(1).lqhhtzsp));
												BigDecimal i2 = new BigDecimal(getTeamMinSP(list.get(2).lqhhtzsp));
												BigDecimal i3 = new BigDecimal(getTeamMinSP(list.get(3).lqhhtzsp));
												BigDecimal i4 = new BigDecimal(getTeamMinSP(list.get(4).lqhhtzsp));
												BigDecimal i5 = new BigDecimal(getTeamMinSP(list.get(5).lqhhtzsp));
												BigDecimal i6 = new BigDecimal(getTeamMinSP(list.get(6).lqhhtzsp));
												BigDecimal i7 = new BigDecimal(getTeamMinSP(list.get(7).lqhhtzsp));
												bdminM = i0.multiply(i1).multiply(i2).multiply(i3).multiply(i4).multiply(i5).multiply(i6).multiply(i7);
												isFirst = false;
											}
											if (bdtemp.compareTo(bdminM) == -1 || bdtemp.compareTo(bdminM) == 0) {
												bdminM = bdtemp;
											}
										}
									}
								}
							}
						}
					}
				}
			}
		}
		result = c + "|" + bdminM + "|" + bdmaxM;
		// Log.d("JclqHHMoneyForecastUtil ", "getMatchCount result= " + result);
		return result;

	}

}
